function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

var today = new Date()	//today	
                        // var today = new Date(2008,11,12)	//to set a date of 2008, December 12th for test purposes
var meeting = new Date()  // used for date of WMA meeting

//determine the date of meeting in current month

meeting.setDate(8)	//8 the earlest 2nd Tuesday in month
if(meeting.getDay()<3)	// getDay: 1 is a monday, 2 tuesday etc
		{meeting.setDate(10-meeting.getDay())}	// 
	else meeting.setDate(17-meeting.getDay())	// 

//if date of meeting has passed, change to next month

if(meeting.getDate()<today.getDate())
	{if(today.getMonth()==11)
		{meeting.setMonth(0)
		meeting.setYear(meeting.getYear()+1)
	}
else meeting.setMonth(meeting.getMonth()+1)
}
				
//determine the date of meeting in next month
meeting.setDate(8)	//the earlest 2nd Tuesday in month
if(meeting.getDay()<3)	// 
	{meeting.setDate(10-meeting.getDay())}	// was
else meeting.setDate(17-meeting.getDay())	// was 

//set name of month
with (meeting)
{	if(getMonth() == 0) {Month ="January"}
	if(getMonth() == 1) {Month ="February"}
	if(getMonth() == 2) {Month ="March"}
	if(getMonth() == 3) {Month ="April"}
	if(getMonth() == 4) {Month ="May"}
	if(getMonth() == 5) {Month ="June"}
	if(getMonth() == 6) {Month ="July"}
	if(getMonth() == 7) {Month ="August"}
	if(getMonth() == 8) {Month ="September"}
	if(getMonth() == 9) {Month ="October"}
	if(getMonth() == 10) {Month ="November"}
	if(getMonth() == 11) {Month ="December"}
}

//should the sufix be "th" or "st"

//	if(meeting.getDate()==21||meeting.getDate()==1)
//		{thorst="st"}
//	else
thorst="th"
wait=Math.floor(meeting.getTime()/(1000*60*60*24))-Math.floor(today.getTime()/(1000*60*60*24))  //convert dates to time between then to days, uses milli-seconds as the time interval		

function ShowCountDown(){
	document.write("<h4>Next meeting is at 8:00 pm Tuesday "+meeting.getDate()+"<SUP><font size='-2'>"+thorst+"</font></SUP> ")
	if(meeting.getYear()>1999){document.write(Month+" "+meeting.getYear()+"</H4>")}
	else {document.write(Month+" "+(meeting.getYear()+1900)+"</h4>")}
	if(wait==0){document.write("<H2<FONT COLOR=\"Red\">T O D A Y</font></H2>")}
	if(wait==1){document.write("<H2><FONT COLOR=\"Red\">T O M O R R O W</font></H2>")}
	if(wait==2){document.write("<H2><Font color=\"red\">The Day After Tomorrow.</font></h2>")}	
	if(wait>2){document.write("<H4>Only "+wait+" days to the next meeting.</H4>")}
}

function RedDay(d1,m1,y1,d2, m2, y2) {
	var date1 = new Date(y1,m1-1,d1) 
	var date2 = new Date(y2,m2-1,d2)
	if(today > date1 && today <= date2){  // if today is after first date and including second date, then format in RED
		document.write('<span class="next">')
	}
	else if(today>=date1){				// if the date has past
		document.write('<span class="past">')
	}
	else{
		document.write('<span>')
	}
}

// to enter the directory name to get to the members area.  Required on the Members.htm page.
  function memb_function()  {
  window.location="./members_only/" + document.forms.member.wma_member.value + "/start.htm";
  }
